package com.lagou.edu.controller;

import com.lagou.edu.service.LagouAuthCodeService;
import com.lagou.edu.service.impl.LagouAuthCodeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName CodeController
 * @Description TODO
 * @Auth ying.xiao
 * @Date 2021/4/20
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private LagouAuthCodeServiceImpl lagouAuthCodeServiceImpl;

    @GetMapping("/create/{email}")
    public boolean create(@PathVariable String email){
        return  lagouAuthCodeServiceImpl.create(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable String email,@PathVariable String code){
        return  lagouAuthCodeServiceImpl.validate(email,code);
    }
}
